﻿using System.Web.Script.Serialization;

namespace JULONG.WEB.Library
{
    public static partial class staticClass
    {
        //jsonHelper
        public static string ToJSON(this object obj)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            return serializer.Serialize(obj);
        }

        public static string ToJSON(this object obj, int recusionDepth)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            serializer.RecursionLimit = recusionDepth;
            return serializer.Serialize(obj);
        }

        public static string ToTryString(this object obj)
        {
            return obj == null ? null : obj.ToString();
        }

        
    }
}
